package unit3.part3;

import java.util.Scanner;

/**
 * 闰年计算
 */
public class LeapYear {

    public static void main(String[] args) {
        System.out.println("请输入待检测的年数：");
        Scanner scanner = new Scanner(System.in);
        //获取用户输入的年份
        int year = scanner.nextInt();
        scanner.close();

        //年份必须在2000-3000之内
        if (year < 2000 || year > 3000) {
            System.out.println("请输入2000~3000内的年数！");
            return;
        }

        //判断是否为闰年
        if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
            System.out.println(year + "年是闰年");
        } else {
            System.out.println(year + "年不是闰年");
        }
    }
}
